package org.liveboardgames.agricola.control.delegates.action.prerequisite
{
    import org.liveboardgames.agricola.model.enums.HouseTypeEnum;
    import org.liveboardgames.agricola.model.enums.PrerequisiteEnum;
    import org.liveboardgames.agricola.vo.player.Player;
    
    public class PrerequisiteFactory
    {
        
        public static function getPrerequisiteChecker(prerequisite:String, player:Player):PrerequisiteChecker
        {
            var checker:PrerequisiteChecker = null;
            if (PrerequisiteEnum.WOODEN_HOUSE == prerequisite)
            {
                checker = new HousePrerequisiteChecker(player, HouseTypeEnum.WOODEN);
            }
            else if (PrerequisiteEnum.CLAY_HOUSE == prerequisite)
            {
                checker = new HousePrerequisiteChecker(player, HouseTypeEnum.CLAY);
            }
            else if (PrerequisiteEnum.STONE_HOUSE == prerequisite)
            {
                checker = new HousePrerequisiteChecker(player, HouseTypeEnum.STONE);
            }
            else if (PrerequisiteEnum.EMPTY_SPACE == prerequisite)
            {
                checker = new EmptySpacePrerequisiteChecker(player);
            }
            else if (PrerequisiteEnum.AVAILABLE_STABLE == prerequisite)
            {
                checker = new StablePrerequisiteChecker(player);
            }
            else if (PrerequisiteEnum.OVEN == prerequisite)
            {
                checker = new OvenPrerequisiteChecker(player);
            }
            else if (PrerequisiteEnum.BUILD_MAJOR_IMPROVEMENT == prerequisite)
            {
                checker = new BuildMajorImprovementPrerequisiteChecker(player);
            }
            else if (PrerequisiteEnum.FREE_FIELD == prerequisite)
            {
                checker = new FreeFieldPrerequisiteChecker(player);
            }
            else if (PrerequisiteEnum.CAN_BUILD_PASTURE == prerequisite)
            {
                checker = new FencePrerequisiteChecker(player);
            }
            // Not useful anymore
            /*else if (PrerequisiteEnum.RENOVATION_TO_CLAY == prerequisite)
            {
                checker = new RenovationPrerequisiteChecker(player, HouseTypeEnum.CLAY);
            }
            else if (PrerequisiteEnum.RENOVATION_TO_STONE == prerequisite)
            {
                checker = new RenovationPrerequisiteChecker(player, HouseTypeEnum.STONE);
            }*/
            else if (PrerequisiteEnum.EMPTY_ROOM == prerequisite)
            {
                checker = new EmptyRoomPrerequisiteChecker(player);
            }
            else if (PrerequisiteEnum.AVAILABLE_PEEP == prerequisite)
            {
                checker = new AvailablePeepPrerequisiteChecker(player);
            }
            else if (PrerequisiteEnum.ROUND_FIVE == prerequisite)
            {
                checker = new RoundFivePrerequisiteChecker(player);
            }
            else
            {
                trace("No checker for " + prerequisite);
            }
            return checker;
        }
    
    }
}